package com.example.deom.common;

import com.example.deom.entity.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class UserSessionTools {
    public static UserInfo getLoginUser(HttpServletRequest request){
        HttpSession session = request.getSession(false);
        if(session != null && session.getAttribute(ApplicationVariable.SESSION_KEY_USERINFO) != null){
            return (UserInfo) session.getAttribute(ApplicationVariable.SESSION_KEY_USERINFO);
        }
        return null;
    }
}
